<!--
Copyright 2017 The Kubernetes Authors.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->

<h2
  mat-dialog-title
  i18n
>
  Delete a resource
</h2>
<mat-dialog-content class="kd-dialog-text">
  <ng-container i18n>
    <span>Are you sure you want to delete {{ data.displayName }} <i>{{ data.objectMeta.name }}</i></span>
    <span *ngIf="data.objectMeta.namespace"> &nbsp;in namespace <i>{{ data.objectMeta.namespace }}</i> </span>
    <span>?</span>
  </ng-container>
  <ng-container>
    <div
      class="kd-dialog-propagation-select-container"
      i18n
    >
      Propagation policy
      <mat-select
        [(ngModel)]="options.propagation"
        class="kd-dialog-propagation-select"
      >
        <mat-option
          *ngFor="let propagation of DeletionPropagation | values"
          [value]="propagation"
        >
          {{ propagation }}
        </mat-option>
      </mat-select>
    </div>
  </ng-container>
  <ng-container>
    <div class="kd-dialog-delete-checkbox">
      <mat-checkbox
        color="primary"
        [(ngModel)]="options.deleteNow"
        name="deleteNow"
        matInput
        i18n
        >Delete now (sets delete grace period to 1 second instead of the default, which is usually 30
        seconds)</mat-checkbox
      >
    </div>
  </ng-container>
  <div
    class="kd-equivalent-block kd-muted kd-bg-card-dark"
    fxLayoutAlign=" center"
  >
    <mat-icon>info</mat-icon>
    <div>
      <div i18n>This action is equivalent to:</div>
      <code>
        <ng-container>kubectl delete </ng-container>
        <ng-container *ngIf="data.objectMeta.namespace">-n {{ data.objectMeta.namespace }} </ng-container>
        <ng-container *ngIf="options.deleteNow">--now </ng-container>
        <ng-container>{{ data.typeMeta.kind }} {{ data.objectMeta.name }} </ng-container>
        <ng-container>--cascade={{ options.propagation.toLocaleLowerCase() }}</ng-container>
      </code>
    </div>
  </div>
</mat-dialog-content>
<mat-dialog-actions>
  <button
    mat-button
    color="primary"
    id="confirm-delete"
    [mat-dialog-close]="options"
    i18n
  >
    Delete
  </button>
  <button
    mat-button
    color="primary"
    [mat-dialog-close]="undefined"
    i18n
  >
    Cancel
  </button>
</mat-dialog-actions>
